Skip to content

1.0.3: a host a browser reads as another IPv4 address is refused; the URLs 1.0.2 missed are checked - #27

Merged
echarles merged 1 commit into
mainfrom
fix/canonical-numeric-hosts
Nov 24, 2026
Merged

echarles merged 1 commit into
mainfrom
fix/canonical-numeric-hosts

Conversation

@echarles

Copy link
Copy Markdown
Member

What

Release 1.0.3, the follow-up to 1.0.2 (#26) from the review of its fix. Python SDK only. The TypeScript SDK parses URLs with WHATWG URL, as a browser does; only its version strings change.

Non-canonical numeric hosts

The ASCII allowlist accepted hosts a browser reads as another IPv4 address. Each of these keeps its written hostname in urlsplit:

  • https://0x7f.1/device and https://0177.0.0.1/device: a browser reads both as 127.0.0.1.
  • https://3.1.2/device: a browser reads 3.1.0.2. A company whose domain is 1.2 also admitted it as a "subdomain".

Two changes:

  • browser_safe uses WHATWG's "ends in a number" rule. A host whose last label is all digits, or 0x and hexadecimal digits, is a browser's IPv4 address, so it is accepted only as a canonical dotted quad: four decimal parts, 0 to 255, no leading zero, no trailing dot.
  • host_within(host, domain): an IP address has no subdomains, and is within only itself. It replaces the three suffix checks: device sign-in links, the company's device_page, and Browser Control's company hosts.

The URLs 1.0.2 missed

These accepted an https:// URL without browser_safe, and now ask it too:

  • PapSignIn.organization_logo
  • UcpProfile.endpoint and ucp_agent_header (the platform profile)
  • a Signature-Agent: when sent, it is refused; when verified, one a browser reads otherwise decides nothing (unverified), as a Signature-Agent that is no URL already did
  • a Session JWT's issuer, before it is fetched
  • the entries of protected_resources

Tests

  • test_urls.py: abbreviated, octal, hexadecimal, single-number, leading-zero, out-of-range and trailing-dot hosts refused. Canonical addresses and names are still accepted. host_within without subdomains for addresses. The logo and the UCP endpoint each refuse the backslash and a numeric host. A check that every prefix-only site asks browser_safe.
  • The whole Python suite: 1737 passed.
  • The 1.0.1 reporter's script still passes: both controls hold, and both backslash cases are refused.

Version

1.0.3 in __version__.py, package.json, the four runtime plugin manifests, the compatibility page, the conformance report and the CHANGELOG.

… URLs 1.0.2 missed are checked

A browser reads https://0x7f.1/, https://0177.0.0.1/ and https://3.1.2/ as 127.0.0.1,
127.0.0.1 and 3.1.0.2; a host that ends in a number is accepted only as a canonical
dotted quad (browser_safe), and an IP address has no subdomains (host_within, for device
sign-in links, the company's device page and Browser Control's company hosts).

A company's logo, a UCP profile's endpoint, the platform profile, a Signature-Agent (sent and
verified; one a browser reads otherwise decides nothing), a Session JWT's issuer and the
entries of protected_resources are checked as every HTTPS URL is.

Tests: test_urls (+5, 41), the whole suite (1737).
Copilot AI balanced review requested due to automatic review settings November 24, 2026 15:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

URL validation still accepts a browser-interpreted loopback URL, can raise an uncaught exception on oversized numeric components, and rejects valid IPv6 literals containing dotted quads.

3 open issues
What changed in this PR

Release 1.0.3 strengthens Python SDK URL validation following the 1.0.2 security fix. TypeScript runtime behavior is unchanged; only version strings are updated.

Changes:

  • Reject non-canonical numeric hosts and prevent IP addresses from matching as subdomains.
  • Extend browser-safe URL checks to previously missed validation paths.
  • Add regression tests and update release versions and documentation.
File Description
src/​reactor.ts Bump core plugin version.
src/​company/​index.ts Bump company plugin version.
personal_agent_protocol/​urls.py Add numeric-host validation and shared host containment checks.
personal_agent_protocol/​ui.py Validate organization logo URL safety.
personal_agent_protocol/​ucp.py Validate endpoint and platform profile URL safety.
personal_agent_protocol/​reactor.py Bump Python core plugin version.
personal_agent_protocol/​operator_signatures.py Check Signature-Agent URL safety when signing and verifying.
personal_agent_protocol/​models.py Check protected-resource URL safety.
personal_agent_protocol/​device.py Use shared host containment for sign-in links.
personal_agent_protocol/​company/​verify.py Check Session JWT issuer URL safety.
personal_agent_protocol/​company/​service.py Use shared host containment for device pages.
personal_agent_protocol/​company/​__init__.py Bump Python company plugin version.
personal_agent_protocol/​browser_control.py Use shared company-host containment checks.
personal_agent_protocol/​__version__.py Set Python SDK version to 1.0.3.
personal_agent_protocol/​__tests__/​test_urls.py Add numeric-host, containment, and URL-check regressions.
package.json Set TypeScript package version to 1.0.3.
docs/​docs/​releases/​compatibility.mdx Document 1.0.3 compatibility and validation changes.
docs/​docs/​protocol/​conformance-report.mdx Update the reported SDK version.
CHANGELOG.md Describe the 1.0.3 security follow-up.

Review effort: Balanced

if not all(character in _AUTHORITY_CHARACTERS for character in netloc):
return False
try:
host = urlsplit(value).hostname or ""

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed with Node's WHATWG URL: https:///0x7f.1/, https:/0x7f.1/ and https:0x7f.1/ all open 127.0.0.1. Fixed in #28 (1.0.4): browser_safe refuses a URL with no host for urlsplit, with regression cases for the three forms.

# A host a browser reads as an IPv4 address is one only in its canonical form: a
# browser reads `0x7f.1`, `0177.0.0.1` and `3.1.2` as 127.0.0.1, 127.0.0.1 and
# 3.1.0.2, the SDK as the names they are written (the review of 1.0.2).
return not ends_in_a_number(host) or canonical_ipv4(host)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, fixed in #28 (1.0.4): an IPv6 literal is exempt from the IPv4 rule, and [::ffff:93.184.216.34] is a regression case.

part.isascii()
and part.isdigit()
and (part == "0" or not part.startswith("0"))
and int(part) <= 255

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed, fixed in #28 (1.0.4): a part longer than three digits is refused before int. The tests cover canonical_ipv4, browser_safe and UcpProfile.endpoint, and an oversized issuer refused by unverified_session_issuer with invalid_session.

@echarles
echarles merged commit 838ed0d into main Nov 24, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants